package com.ygqh.baby.service;

import java.util.List;

import com.ygqh.baby.ao.CustomerStatus;
import com.ygqh.baby.ao.DataStatus;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.ResultSet;
import com.ygqh.baby.model.CustomerUser;
import com.ygqh.baby.model.YgUserModel;

public interface CustomerUserService {

	/**
	 * 保存
	 * @param customerUser
	 */
	void save(CustomerUser customerUser);

	/**
	 * 修改
	 * @param customerUser
	 */
	void updateEntity(CustomerUser customerUser);

	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	CustomerUser findUserById(String id);

	/**
	 * 根据客服登录名查询
	 * @param username
	 * @return
	 */
	CustomerUser findByUserName(String username);

	/**
	 * 修改客服在线状态
	 * @param userName
	 * @param customerStatus
	 * @return
	 */
	Message updateCustomerStatus(String userName, CustomerStatus customerStatus);
	
	/**
	 * 为用户分配客服
	 * @param ygUser
	 * @param onlineCustomerId
	 * @return
	 */
	Message distributionCustomerToUser(YgUserModel ygUser, String onlineCustomerId);

	/**
	 * 获取其他在线用户
	 * @param userId
	 * @return
	 */
	List<CustomerUser> findCustomerList(String userName, Boolean isDefault, CustomerStatus customerStatus);

	/**
	 * 把用户转接给其他客服
	 * @param currentCustomerId
	 * @param transCustomerId
	 * @param userId
	 * @return
	 */
	Message updateUserToOtherCustomer(String currentCustomerId, String transCustomerId, Long userId);

	/**
	 * 修改用户的星标
	 * @param customerId
	 * @param userId
	 * @param isStar
	 * @return
	 */
	Message updateUserByIsStar(String customerId, Long userId, Boolean isStar);

	/**
	 * 搜索客服列表结果
	 * @param queryInfo
	 * @param nickName
	 * @param customerStatus
	 * @param status
	 * @return
	 */
	ResultSet<CustomerUser> searchCustomerUser(QueryInfo queryInfo, String nickName, CustomerStatus customerStatus, DataStatus status);

	/**
	 * 
	 * @param customerUser
	 * @param ygUser
	 */
	void updateCustomerWithUser(CustomerUser customerUser, YgUserModel ygUser);

	/**
	 * 验证客服
	 * @param customerId
	 * @return
	 */
	CustomerUser validateCustomer(String customerId, YgUserModel ygUser);

	/**
	 * 修改客服信息数据状态
	 * @param id
	 * @param status
	 * @return
	 */
	Message updateCustomerUserByStatus(String id, DataStatus status);

	List<CustomerUser> findCustomerList(QueryInfo queryInfo, String nickName, CustomerStatus customerStatus, DataStatus status);

	List<YgUserModel> findUserList(String q, CustomerUser customerUser);

	/**
	 * 判断UserName是否已存在
	 * @param userName
	 * @param id
	 * @return
	 */
	CustomerUser isExistsByUserName(String userName, String id);

	/**
	 * 客服退出系统更新数据
	 * @param userName
	 */
	void updateCustomerWithLogout(String userName);

	void updateUserByIsOnline(Long userId, Boolean isOnline);

	/**
	 * 获取留言客服信息
	 * @return
	 */
	CustomerUser findCustomerByDefault();

	/**
	 * 根据客服查询用户列表
	 * @param customerUser
	 * @return
	 */
	List<YgUserModel> findUserList(CustomerUser customerUser);

	/**
	 * 搜索用户列表
	 * @param q
	 * @return
	 */
	List<YgUserModel> searchUserList(String q);

	/**
	 * 获取所有标星用户
	 * @param isStar
	 * @return
	 */
	List<YgUserModel> findUserListByIsStar(Boolean isStar);

	/**
	 * 删除用户
	 * @param userIds
	 * @param customerUserName
	 * @return
	 */
	Message deleteUserFromCustomer(Long[] userIds, String customerUserName);
}
